//index.js
//获取应用实例
const app = getApp()

Page({
  data: {
    motto: 'Hello World',
    inputValue: '',
    userInfo: {},
    allProductInfo: [],
    someProductInfo: [],
    hasUserInfo: false,
    isAll: true,
    isSome: false,
    isSearchAll: false,
    isShow: false, //0=单个 1:所有
    canIUse: wx.canIUse('button.open-type.getUserInfo')
  },
  //事件处理函数
  bindViewTap: function() {
    wx.navigateTo({
      url: '../logs/logs'
    })
  },
  onLoad: function() {
    this.loadData();
  },
  loadData: function() {
    this.setData({
      allProductInfo: wx.getStorageSync('localData')
    })
  },
  toPage: function (event) {
    var pagename = event.currentTarget.dataset.pagename;
    wx.navigateTo({
      url: '../'+pagename+'/' + pagename
    })
  },

  /**
   * 用户点击右上角分享（index.js）
   */
  onShareAppMessage: function(ops) {
    if (ops.from === 'button') {
      console.log(ops.target)
    }
    return {
      title: '抓娃小兵的小程序',
      path: 'pages/index/index',
      success: function(res) {
        console.log("转发成功:" + JSON.stringify(res));
      },
      fail: function(res) {
        // 转发失败
        console.log("转发失败:" + JSON.stringify(res));
      }
    }

  }

})